package com.dh.blog.controllers;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.dh.blog.service.CalendarService;
import com.dh.blog.vo.CalendarPagerVo;
import com.dh.blog.vo.PagerVo;
import com.ewei.web.common.json.resolver.JsonModel;
import com.ewei.web.common.response.ResponseVO;

@Controller
@RequestMapping(value="/daily")
public class CalendarController {
	@Resource(name="calendarService")
	private CalendarService calendarService;
	@RequestMapping(value="/{blog_id:\\w+}",method=RequestMethod.GET)
	public ModelAndView page(@PathVariable("blog_id")String blogId){
		ModelAndView view = new ModelAndView("daily");
		return view;
	}
	@RequestMapping(value="/list/{blog_id:\\w+}",method=RequestMethod.GET)
	public Object pager(@PathVariable("blog_id")String blogId,
			@JsonModel CalendarPagerVo pager){
		pager.setBlogId(blogId);
		CalendarPagerVo result = calendarService.findPager(pager);
		return new ResponseVO().setDatas(result);
	}
}
